package com.tgy.testBean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/***
 * @ClassName: Test
 * @Description:
 * @Auther: 送一一块二向箔
 * @Date: 16:43 2022/2/25
 * @version : V1.0
 */
@Component
@PropertySource(value = "classpath:database.properties",encoding = "utf-8")
public class TestUseBean {
    @Value("${tgy.name.aaa}")
    private String name;

    @Value("${end}")
    private String end;

    @PostConstruct
    private void init(){
        System.out.println(this.name);
    }

    @PreDestroy
    private void aaa(){
        System.out.println(this.end);
    }

    @Override
    public String toString() {
        return "TestUseBean{" +
                "name='" + name + '\'' +
                ", end='" + end + '\'' +
                '}';
    }
}
